package game.model.converter;

import common.model.po.GItem;
import game.model.request.SaveItemRequest;
import game.model.vo.ItemDetailVo;

/**
 * @author 米泽鹏
 * @since 2022-2-28 下午 4:55
 */
public class GItemConverter {

	public static GItem saveRequestToPo(SaveItemRequest saveItemRequest) {
		if (saveItemRequest == null) {
			return null;
		}
		GItem gItem = new GItem();
		gItem.setClassificationId(saveItemRequest.getClassificationId());
		gItem.setSort(saveItemRequest.getSort());
		gItem.setItemName(saveItemRequest.getItemName());
		gItem.setDescription(saveItemRequest.getDescription());
		gItem.setFluid(saveItemRequest.getFluid());
		gItem.setStack(saveItemRequest.getStack());
		gItem.setEnergy(saveItemRequest.getEnergy());
		gItem.setResourceSinkPoints(saveItemRequest.getResourceSinkPoints());
		gItem.setDamage(saveItemRequest.getDamage());
		gItem.setEquippable(saveItemRequest.getEquippable());
		gItem.setEquipmentLocation(saveItemRequest.getEquipmentLocation());
		gItem.setHandmade(saveItemRequest.getHandmade());
		gItem.setImage(saveItemRequest.getImage());
		gItem.setId(saveItemRequest.getId());
		return gItem;
	}

	public static ItemDetailVo poToItemDetailVo(GItem gItem) {
		if (gItem == null) {
			return null;
		}
		ItemDetailVo itemDetailVo = new ItemDetailVo();
		itemDetailVo.setItemName(gItem.getItemName());
		itemDetailVo.setDescription(gItem.getDescription());
		itemDetailVo.setFluid(gItem.getFluid());
		itemDetailVo.setStack(gItem.getStack());
		itemDetailVo.setEnergy(gItem.getEnergy());
		itemDetailVo.setResourceSinkPoints(gItem.getResourceSinkPoints());
		itemDetailVo.setDamage(gItem.getDamage());
		itemDetailVo.setEquippable(gItem.getEquippable());
		itemDetailVo.setEquipmentLocation(gItem.getEquipmentLocation());
		itemDetailVo.setHandmade(gItem.getHandmade());
		itemDetailVo.setImage(gItem.getImage());
		itemDetailVo.setClassificationId(gItem.getClassificationId());
		itemDetailVo.setSort(gItem.getSort());
		itemDetailVo.setId(gItem.getId());
		itemDetailVo.setOperator(gItem.getOperator());
		itemDetailVo.setCreateTime(gItem.getCreateTime());
		itemDetailVo.setUpdateTime(gItem.getUpdateTime());
		return itemDetailVo;
	}
}
